<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../favicon.ico">

    <title>题目管理</title>
    <base href="${pageContext.request.scheme }://${pageContext.request.serverName }:${pageContext.request.serverPort }${pageContext.request.contextPath }/ "/>

    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
    <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
    <script src="https://cdn.jsdelivr.cn/npm/jquery@1.12.4/dist/jquery.min.js" integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"></script>
    <!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>

    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <link href="../../assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="../../css/signin.css" rel="stylesheet">

    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
    <script src="../../assets/js/ie-emulation-modes-warning.js"></script>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body style="margin: 0px;padding: 0px;background-color: #fff">
    <form action="/searchByContent" method="get">
        <input type="hidden" value="searchByContent" name="m">
        <input type="text" placeholder="请输入题目" name="content">
        <input type="submit" value="搜索">
    </form>
    <p><a href="addQuestion.html">添加题目</a></p>
    <table class="table table-bordered table-hover">
        <thead>
            <tr class="success">
                <th>编号</th>
                <th>题目</th>
                <th>选项A</th>
                <th>选项B</th>
                <th>选项C</th>
                <th>选项D</th>
                <th>答案</th>
                <th>难度</th>
                <th>考试题编号</th>
                <th>图片</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            <c:forEach var="question" items="${page.data}">
                <tr>
                    <td>${question.id}</td>
                    <td>${question.content}</td>
                    <td>${question.optionA}</td>
                    <td>${question.optionB}</td>
                    <td>${question.optionC}</td>
                    <td>${question.optionD}</td>
                    <td>${question.answer}</td>
                    <td>${question.difficulty}</td>
                    <td>${question.questionSetId}</td>
                    <td>
                        <c:choose>
                            <c:when test="${question.image != null}">
                                <img src="/image/${question.image}" style="width: 40px;height: 40px">
                            </c:when>
                        </c:choose>
                    </td>
                    <td>
                        <a href="/findQuestionById?id=${question.id}">更新</a>
                        <a href="javascript:if(confirm('是否确认删除？'))location.href='/removeQuestion?id=${question.id}'">删除</a>
                    </td>
                </tr>
            </c:forEach>
        </tbody>
    </table>
    <nav aria-label="Page navigation" >
        <ul class="pagination">
            <c:choose>
                <c:when test="${page.current>1}">
                    <li>
                        <a href="/findPage?current=${page.current-1}" aria-label="Previous">
                            <span aria-hidden="true">&laquo;</span>
                        </a>
                    </li>
                </c:when>
                <c:otherwise>
                    <li class="disabled">
                        <a aria-label="Previous">
                            <span aria-hidden="true">&laquo;</span>
                        </a>
                    </li>
                </c:otherwise>
            </c:choose>
            <c:forEach var="i" begin="1" end="${page.pageCount}" step="1">
                <li class="${page.current==i?'active':''}"><a href="/findPage?current=${i}">${i}</a></li>
            </c:forEach>
            <c:choose>
                <c:when test="${page.current<page.pageCount}">
                    <li>
                        <a href="/findPage?current=${page.current+1}" aria-label="Next">
                            <span aria-hidden="true">&raquo;</span>
                        </a>
                    </li>
                </c:when>
                <c:otherwise>
                    <li class="disabled">
                        <a aria-label="Next">
                            <span aria-hidden="true">&raquo;</span>
                        </a>
                    </li>
                </c:otherwise>
            </c:choose>
        </ul>
    </nav>
</body>
</html>
